<template>
  <section class="jumbotron">
      <h3 class="jumbotron-heading">Search Github Users</h3>
      <div>
        <input type="text" v-model="keyValue" placeholder="enter the name you search" @keyup.enter="sendKeyValue"/>&nbsp;
        <button @click="sendKeyValue">Search</button>
      </div>
    </section>
</template>

<script>
export default {
    name:'Search',
    data() {
        return {
            keyValue:''
        }
    },
    methods:{
        sendKeyValue(){
            if(!this.keyValue.trim()){
                alert('不能输入空值');
                return
            } 
            this.$bus.$emit('getUsers',this.keyValue)
        }
    }
}
</script>

<style>

</style>